import { createApp } from "vue"
import { createPinia } from "pinia"

import App from "@/App.vue"
import router from "@/router"

import VConsole from "vconsole"
import { getParameterByName, getSessionStorageItem, setSessionStorageItem } from "@/utils/common"
import "vant/es/toast/style"

// Dialog
import "vant/es/dialog/style"

// Notify
import "vant/es/notify/style"

// ImagePreview
import "vant/es/image-preview/style"

let vConsole = null
let vConsoleDebug = getParameterByName("vConsoleDebug", window.location.href)
// console.log(vConsoleDebug, "vConsoleDebug")
// vConsole = new VConsole()
if (vConsoleDebug === "yes") {
  setSessionStorageItem("vConsoleDebug", vConsoleDebug)
  vConsole = new VConsole()
}
vConsoleDebug = getSessionStorageItem("vConsoleDebug")
if (vConsoleDebug === "yes" && vConsole === null) {
  vConsole = new VConsole()
}
if (typeof window.entryUrl === "undefined" || window.entryUrl === "") {
  window.entryUrl = window.location.href.split("#")[0]
}

const app = createApp(App)
app.use(createPinia())
app.use(router)
app.mount("#app")
